<?php
/**
 * setup.php
 *
 * will start the madoqua install after setting up url rewriting
 * 
 * Norm Rawks! \ó/
 *
 * @category    Madoqua
 * @package     Install
 */

require_once('madoqua_private/library/Zend/Loader.php');
Zend_Loader::registerAutoload();

$viewFile = 'Zend/View.php';

$includePath = realpath(getcwd()) . '/madoqua_private/library/';

//set up include path
$includePath = realpath(getcwd()) .
               DIRECTORY_SEPARATOR . 
               'madoqua_private' . 
               DIRECTORY_SEPARATOR . 
               'library';
set_include_path($includePath . PATH_SEPARATOR . get_include_path() );


if (($fh = @fopen($viewFile, 'r', true))) {
    //we can open the view file directly 
    //ZF is in the path, go mirmo!
    require_once $viewFile;
    
} else {
    //it isn't in the path, but don't panic, madoqua can come with ZF! \ó/
    
    $privateViewFile = $includePath . $viewFile;
    //view file in madoqua itself (ZF included)
    
    if (($fh = @fopen($privateViewFile, 'r', true))) {
        require_once $privateViewFile;
    } else {
        die('Zend_View was not found in your path, nor in your Madoqua package.');
    }
}

/** installer */
require_once 'Madoqua/Install.php';

$install = new Madoqua_Install();
echo $install->execute()->getBody();
//let's install this dikdik 8^]